package com.weharvest.edu.dao;

import com.weharvest.edu.entity.BackstageRole;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface BackstageRoleDao  extends JpaRepository<BackstageRole,String>{

    BackstageRole findByIdAndStateAndFlag(String id, Integer state, String flag);

    BackstageRole findByIdAndFlag(String id,  String flag);

     /**
     * 指定两个是否存在父子关系
     */
    @Query("SELECT br FROM BackstageRole  br " +
            " where br.pid  like concat('%',?1,'%',?2 ,'%')  and br.flag =?3  ")
    List<BackstageRole> parentExistChildren(String pid,String cid, String flag);

}
